package spring.controller;

import java.text.SimpleDateFormat;

import org.apache.log4j.Logger;
import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.web.bind.ServletRequestDataBinder;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.InitBinder;

@ControllerAdvice
public class AdviceControlller {

	private Logger logger = Logger.getLogger(this.getClass());
	
	/*@ExceptionHandler(Exception.class)
	public String doException(Exception ex){
		logger.error(ex.getMessage(),ex);
		return "error/exception";
	}*/
	
	@InitBinder
	public void InitBinder (ServletRequestDataBinder binder){
		binder.registerCustomEditor(
		java.util.Date.class, 
		new CustomDateEditor(new SimpleDateFormat("yyyy-MM-dd"), true));
	}
	
	
}
